#if 0
#include <buola/gui.h>

#include <buola/image/cgc.h>
#include <buola/image/cfont.h>

#include <buola/widgets/cmessagebox.h>
#include <buola/widgets/cbutton.h>
#include <buola/widgets/cdialoglayoutmanager.h>

namespace buola { namespace gui {

CMessageBox::CMessageBox(const PWindow &pOwner,const std::wstring &pTitle,const std::wstring &pText,TStyle pStyle)
{
    ///\todo convert to frame and fix this
    mText=pText;
    SetStyle(pStyle);

    mOwner=pOwner;
    SetWindowType(EWindowType::MESSAGEBOX);
//     Create(nullptr);
//     SetTitle(pTitle);
//     StayOnTopOf(mOwner);
//     SetPossibleActions(ACTION_NONE);
//     SetSizeHints(HINT_FIXEDSIZE);
    mResult=-1;

    mFont=img::CFont::GetStock(L"control");

    Shape();

    PButton lButton;
    
    if(GetStyle(MBS_YES))
    {
        lButton=new CButton;
        lButton->ePressed.Connect(&CMessageBox::OnButton,this,MBS_YES);
        lButton->SetCaption(L"Yes");
        mButtons.push_back(lButton);
    }
    if(GetStyle(MBS_NO))
    {
        lButton=new CButton;
        lButton->ePressed.Connect(&CMessageBox::OnButton,this,MBS_NO);
        lButton->SetCaption(L"No");
        mButtons.push_back(lButton);
    }
    if(GetStyle(MBS_OK))
    {
        lButton=new CButton;
        lButton->ePressed.Connect(&CMessageBox::OnButton,this,MBS_OK);
        lButton->SetCaption(L"OK");
        mButtons.push_back(lButton);
    }
    if(GetStyle(MBS_CANCEL))
    {
        lButton=new CButton;
        lButton->ePressed.Connect(&CMessageBox::OnButton,this,MBS_CANCEL);
        lButton->SetCaption(L"Cancel");
        mButtons.push_back(lButton);
    }

    int lButtonsWidth=90*mButtons.size();

    CDialogLayoutManager *lLayout=CDialogLayoutManager::Get(this);

    lLayout->AddVLine(1,WLAY_PERC*50-lButtonsWidth/2);
    lLayout->AddVLine(2,WLAY_PERC*50+lButtonsWidth/2);
    lLayout->AddHLine(3,WLAY_BOTTOM-40);
    lLayout->AddHLine(4,WLAY_BOTTOM-20);

    std::vector<CWindow*> lButtons(mButtons.begin(),mButtons.end());

    lLayout->Array(WLAY_HORIZ,5*WLAY_PERC,1,3,2,4,lButtons);

    for(int i=0;i<mButtons.size();i++)
    {
        Place(mButtons[i]);
    }

    mButtons[0]->SetFocus();
}

CMessageBox::~CMessageBox()
{
}

void CMessageBox::Shape()
{
    CSize_d lSize;

    lSize.x=max(mFont->GetWidth(mText)+40.0,100.0);
    lSize.y=mFont->Metrics().mHeight+100;

    CPoint_d lPos=mOwner->Position()+mOwner->Size()/2-lSize/2;

    MoveResize(lPos,lSize);
}

///////////////// events //////////////////

void CMessageBox::OnExpose(const CExposeEvent &pE)
{
    img::CGC *lGC=pE.mGC;
    
    lGC->Path().MoveTo(CPoint_d(0,0.5));
    lGC->Path().LineTo(CPoint_d(Size().x,0.5));
    lGC->SetSource(img::CColor(L"black"));
    lGC->StrokePath();
    
    lGC->SetFont(mFont);

    lGC->SetSource({0.0,0.0,0.0});
    lGC->DrawText(CPoint_d(20,20),mText);
}

void CMessageBox::OnButton(TID pID)
{
    mResult=pID;
    ///\todo close
    //Destroy();
}

int CMessageBox::NewBox(CWindow *pOwner,const std::wstring &pTitle,
                        const std::wstring &pText,TStyle pStyle)
{
    CMessageBox *lBox=new CMessageBox(pOwner,pTitle,pText,pStyle);
    ///\todo
//    lBox->DoModal();
    return lBox->GetResult();
}


/*namespace gui*/ } /*namespace buola*/ }
#endif